//
//  ShmPartModel.swift
//  ParsingCC
//
//  Created by ins-yangming on 2023/1/7.
//

import UIKit

// MARK: - 音轨
class ShmPartModel: NSObject {
    var id = "P1";
    
    var measures = [ShmMeasureModel]();
    
    func getXmlElement() -> GDataXMLElement{
        let partElement = GDataXMLNode.element(withName: "part");
        if let idAttribute = GDataXMLNode.attribute(withName: "id", stringValue: self.id) as? GDataXMLNode {
            partElement?.addAttribute(idAttribute);
        }
        
        for measure in measures {
            partElement?.addChild(measure.getXmlElement());
        }
        
        
        return partElement!;
    }
}
